<?php
/**
 * Created by PhpStorm.
 * User: eric
 * Date: 11/18/14
 * Time: 17:45
 */
use \eric\widgets\charts\flot\Flot;
$this->title = Yii::t('app', 'Charts');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'samples'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<!--BEGIN HEADER-->
<div class="section-header">
    <h3 class="text-standard"><i class="fa fa-fw fa-arrow-circle-right text-gray-light"></i> <?=$this->title?> <small>morris</small></h3>
</div>
<!--END HEADER-->
<!--BEGIN BODY-->
<div class="section-body">
    <div class="col-lg-6">
        <?php
        \eric\widgets\Box::begin([
            'title' => 'Line Chart',
            'boxStyle' => \eric\widgets\Box::STYLE_SUPPORT3,
        ]);
        echo \eric\widgets\charts\morris\Morris::widget([
            'data' => [
                ['x' => 7, 'y' => '1'],
                ['x' => 6, 'y' => '2'],
                ['x' => 5, 'y' => '3'],
                ['x' => 4, 'y' => '4'],
                ['x' => 3, 'y' => '5'],
                ['x' => 2, 'y' => '6'],
                ['x' => 1, 'y' => '7'],
            ],
            'chartEvents' => [
                'click' => "function(i,row){alert(i),console.info(row)}"
            ],
            'chartType' => \eric\widgets\charts\morris\Morris::TYPE_LINE,
            'clientOptions' => [
                'xkey' => ['x'],
                'ykeys' => ['y'],
                'labels' => ['y']
            ]
        ]);
        \eric\widgets\Box::end();
        ?>
    </div>
    <div class="col-lg-6">
        <?php
        \eric\widgets\Box::begin();
        echo \eric\widgets\charts\morris\Morris::widget([
            'data' => [
                ['x' => 7, 'y' => '1'],
                ['x' => 6, 'y' => '2'],
                ['x' => 5, 'y' => '3'],
                ['x' => 4, 'y' => '4'],
                ['x' => 3, 'y' => '5'],
                ['x' => 2, 'y' => '6'],
                ['x' => 1, 'y' => '7'],
            ],
            'chartType' => \eric\widgets\charts\morris\Morris::TYPE_AREA,
            'clientOptions' => [
                'xkey' => ['x'],
                'ykeys' => ['y'],
                'labels' => ['y']
            ]
        ]);
        \eric\widgets\Box::end();
        ?>
    </div>
    <div class="col-lg-6">
        <?php
        \eric\widgets\Box::begin();
        echo \eric\widgets\charts\morris\Morris::widget([
            'data' => [
                ['x' => 7, 'y' => '1'],
                ['x' => 6, 'y' => '2'],
                ['x' => 5, 'y' => '3'],
                ['x' => 4, 'y' => '4'],
                ['x' => 3, 'y' => '5'],
                ['x' => 2, 'y' => '6'],
                ['x' => 1, 'y' => '7'],
            ],
            'chartType' => \eric\widgets\charts\morris\Morris::TYPE_BAR,
            'clientOptions' => [
                'xkey' => ['x'],
                'ykeys' => ['y'],
                'labels' => ['y']
            ]
        ]);
        \eric\widgets\Box::end();
        ?>
    </div>
    <div class="col-lg-6">
        <?php
        \eric\widgets\Box::begin([
            'boxStyle' => \eric\widgets\Box::STYLE_DANGER,
        ]);
        echo \eric\widgets\charts\morris\Morris::widget([
            'data' => [
                ['label' => "a", 'value' => 23],
                ['label' => "b", 'value' => 24],
                ['label' => "c", 'value' => 17],
            ],
            'chartType' => \eric\widgets\charts\morris\Morris::TYPE_DONUT,
        ]);
        \eric\widgets\Box::end();
        ?>
    </div>
</div>
<!--END BODY-->
<!--BEGIN HEADER-->
<div class="section-header">
    <h3 class="text-standard"><i class="fa fa-fw fa-arrow-circle-right text-gray-light"></i> <?=$this->title?> <small>flot</small></h3>
</div>
<!--END HEADER-->
<!--BEGIN BODY-->
    <?php
    $d1 = [];
    for($i = 0; $i < 14; $i += 0.5){
        $d1[] = [$i, sin($i)];
    }
    $series1 = [
        'data' => $d1,
        'lines' => [
            'show' => true,
            'fill' => true
        ]
    ];
    ?>
<div class="section-body">
    <div class="col-lg-6">
        <?php
        \eric\widgets\Box::begin([
            'title' => 'Line Chart',
            'boxStyle' => \eric\widgets\Box::STYLE_SUPPORT3,
        ]);
        echo Flot::widget([
            'options' => [
                'style' => "width:100%;height:300px;position:relative;"
            ],
            'data' => [
                $d1
            ],
        ]);
        \eric\widgets\Box::end();
        ?>
    </div>
</div>
<!--END BODY-->